package be.dch.typeditor.domain;

import be.dch.gui.i18n.LanguageManager;
import be.dch.util.StringUtils;

public class Line {

    private String type;
    private String subType;
    private String i18nkey;

    public String getType() {
	return this.type;
    }

    public void setType(final String type) {
	this.type = type;
    }

    public String getSubType() {
	return this.subType;
    }

    public void setSubType(final String subType) {
	this.subType = subType;
    }

    public String getI18nkey() {
	return this.i18nkey;
    }

    public void setI18nkey(final String i18nkey) {
	this.i18nkey = i18nkey;
    }

    public String getKey() {
	final StringBuilder responseBuilder = new StringBuilder();
	// TODO fill out until len(3)
	if (!StringUtils.isEmpty(this.subType)) {
	    responseBuilder.append("/" + this.subType);
	}
	return responseBuilder.toString();
    }

    @Override
    public String toString() {
	final String response = LanguageManager.translate(this.i18nkey);
	final StringBuilder responseBuilder = new StringBuilder(this.getKey());
	if (!response.equalsIgnoreCase(this.i18nkey)) {
	    responseBuilder.append(" - " + response);
	}
	return responseBuilder.toString();
    }

}
